//
//  LXWatchHistoryViewCell.m
//  LvXi_newVersion
//
//  Created by 诸葛孔明 on 16/9/7.
//  Copyright © 2016年 SJT. All rights reserved.
//............................................................................................//
//...........................................个人中心-我的特卖-浏览记录...........................................//
//............................................................................................//

#import "LXWatchHistoryViewCell.h"

@implementation LXWatchHistoryViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        UIImageView *iconImageView = [[UIImageView alloc] init];
        [self addSubview:iconImageView];
        self.iconImageView = iconImageView;
        
        UILabel *nameLabel = [[UILabel alloc] init];
        nameLabel.font = [UIFont systemFontOfSize:15];
        nameLabel.textColor = HexColor(@"#333333");
        [self addSubview:nameLabel];
        self.nameLabel = nameLabel;
        
        UILabel *priceLabel = [[UILabel alloc] init];
        priceLabel.font = [UIFont systemFontOfSize:15];
        priceLabel.textColor = HexColor(@"#F0A228");
        [self addSubview:priceLabel];
        self.priceLabel = priceLabel;
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.iconImageView.x = MineRatio(10);
    self.iconImageView.y = MineRatio(15);
    self.iconImageView.width = MineRatio(75);
    self.iconImageView.height = MineRatio(75);
    
    self.nameLabel.width = [self.nameLabel.text sizeInAre:MaxSize font:self.nameLabel.font].width;
    self.nameLabel.height = [self.nameLabel.text sizeInAre:MaxSize font:self.nameLabel.font].height;
    self.nameLabel.x = self.iconImageView.right + MineRatio(10);
    self.nameLabel.y = self.iconImageView.y;
    
    self.priceLabel.width = [self.priceLabel.text sizeInAre:MaxSize font:self.priceLabel.font].width;
    self.priceLabel.height = [self.priceLabel.text sizeInAre:MaxSize font:self.priceLabel.font].height;
    self.priceLabel.x = self.nameLabel.x;
    self.priceLabel.y = self.iconImageView.botton - self.priceLabel.height;
}

- (void)setFrame:(CGRect)frame
{
    frame.origin.x += 10;
    frame.size.width = ScreenWidth - 20;
    [super setFrame:frame];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
